/*
 * @Author: TC(tengchao@taqu.cn)
 * @Date: 2025-11-03 13:49:08
 * @Last Modified by: TC(tengchao@taqu.cn)
 * @Last Modified time: 2025-11-10 11:16:52
 */

import { _decorator, Camera, director, Vec3 } from "cc";
import { app } from "../../../../FrameWork/App";
import { EFrameEventConst } from "../../../../FrameWork/Const/FrameEventConst";
import { BaseScene } from "../../../../FrameWork/Module/Component/BaseScene";
import { EShaderCaseUIConst, ShaderCaseUIConfig } from "./Const/ShaderCaseUIConst";
import { gameShaderCase } from "./GameShaderCase";
const { property, ccclass } = _decorator;

/**
 * 游戏场景
 */
@ccclass("ShaderCaseScene")
export class ShaderCaseScene extends BaseScene {
    @property({ type: Camera, displayName: "主相机" })
    mainCamera: Camera = null;

    /**
     * 初始化
     */
    protected init(): void {
        super.init();
        app.uiMgr.addUICfg(ShaderCaseUIConfig);
        gameShaderCase.globalMgr.mainCamera = this.mainCamera;
    }

    protected registerEvent(): void {
        super.registerEvent();
        app.eventMgr.register(EFrameEventConst.ENTER_GAME_SCENE, this._onEnterGameScene, this);
    }

    /**
     * 打开主界面
     */
    private _onEnterGameScene(): void {
        app.uiMgr.openUI(EShaderCaseUIConst.MainUI, null, () => {
            this.destroyLoadingUI();
        });
    }
}
